﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using InternetModel;
using System.Data.SqlClient;
using System.Data;


namespace InternetDAL
{
  public  class UsersDAL
    {
        //public string connstr = ConfigurationManager.ConnectionStrings["connstring"].ConnectionString;
        SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=ItemOne;Integrated Security=True");
        /// <summary>
        /// 用户登录
        /// </summary>
        public DataTable UsersEnter(Users news)
        {

            ////string sql = "select * from jurisdiction";
            ////SqlConnection conn = new SqlConnection(connstr);//创建字符串对象
            ////SqlCommand command = new SqlCommand(sql,conn);
            ////SqlDataAdapter adapter = new SqlDataAdapter(command);
            ////DataTable dt = new DataTable();
            ////adapter.Fill(dt);


            int num = 0;
           // SqlConnection conn = new SqlConnection(connstr);//创建字符串对象
            conn.Open();
            SqlCommand command = new SqlCommand("Userdeng", conn);//创建command命令
            command.CommandType = CommandType.StoredProcedure;//指定是存储过程
            SqlParameter[] par = {
                                                                  new SqlParameter("@Uname",news.Uname),
                                                                  new SqlParameter("@UID_number",news.UID_number),
                                                                
                                                              };//参数
           
            command.Parameters.AddRange(par);

            SqlDataAdapter adapter = new SqlDataAdapter(command);
            DataTable dt = new DataTable();
            adapter.Fill(dt);

            //int result = Convert.ToInt32(command.ExecuteScalar());//返回单字符
            conn.Close();
            conn.Dispose();
            
            return dt;
        }
    }
}
